package com.dykj.fireFighting.server.socialUnit.xfxg.service.impl;

import com.dykj.fireFighting.api.socialUnit.xfxg.entity.PatrolReport;
import com.dykj.fireFighting.api.socialUnit.xfxg.service.IPatrolReportService;
import com.dykj.fireFighting.common.core.service.impl.BaseServiceImpl;
import com.dykj.fireFighting.server.socialUnit.xfxg.mapper.PatrolReportMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 消防巡更-巡更报告
 *
 * @Author LIJIANJIE
 * @Date  2021-06-23 11:19:32
 */
@Slf4j
@DubboService
@Transactional(rollbackFor = Exception.class)
public class PatrolReportServiceImpl extends BaseServiceImpl<PatrolReportMapper, PatrolReport> implements IPatrolReportService {

    /**
     * 社会单位扣分和
     * @param start
     * @param end
     * @param SocUnitId
     * @return
     */
    @Override
    public int getSocre(String start, String end, String SocUnitId) {
        int dSocre= this.baseMapper.getSocDeduction(start,end,SocUnitId);
        int rSocre= 10-dSocre;
        if(rSocre<0)
        {
            rSocre=0;
        }
        return rSocre;
    }
}
